import requests
from bs4 import BeautifulSoup
# 定义请求头
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
url = 'https://www.pxc.jx.cn/'
response = requests.get(url, headers=headers)
if response.status_code == 200:
    soup = BeautifulSoup(response.content, 'html.parser')
    with open("D:\\萍乡学院.html","w",encoding="utf-8") as file:
        file.write(str(soup))
        print("爬取成功")
else:
    print("爬取失败")